package html;

import java.util.ArrayList;
import main.Message;

/**
 *
 * @author x3m
 */
public class HTML_Chat {

    public static String getHTML(ArrayList<Message> msg) {
        if (msg.isEmpty()) {
            return "Сообщений нет";
        }
        
        String code = "";
        code += "<table id='chatTable'>";
        for (int i = 0; i < msg.size(); i++) {
            
            code += "<tr>";
            code += "<td class='msgTDtime'><p>"+ msg.get(i).getFormattedDate() +"</p></td>";
            code += "<td class='msgTDlogin'><p>["+ msg.get(i).getUserLogin() +"]</p></td>";
            code += "<td class='msgTDtext'>"+ msg.get(i).getText() +"</td>";
            code += "</tr>";
            
        }
        code += "</table>";
        return code;
    }
}
